package com.tjpu.xj.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.tjpu.xj.beans.ProjectBean;
import com.tjpu.xj.beans.StudentBean;
import com.tjpu.xj.dao.ProjectMapper;
import com.tjpu.xj.dao.StudentMapper;
import com.tjpu.xj.util.BaseDao;

@Repository
public class StudentDAOImpl extends BaseDao implements StudentMapper,
		ProjectMapper {

	@Override
	public StudentBean getStudent(int studentCode) {
		try (SqlSession session = getSqlSession()) {
			StudentMapper studentMapper = session
					.getMapper(StudentMapper.class);
			return studentMapper.getStudent(studentCode);
		}
	}

	@Override
	public StudentBean loginCheck(StudentBean student) {
		try (SqlSession session = getSqlSession()) {
			StudentMapper studentMapper = session
					.getMapper(StudentMapper.class);
			return studentMapper.loginCheck(student);
		}
	}

	@Override
	public List<ProjectBean> getUploadedProjects(int studentCode) {
		try (SqlSession session = getSqlSession()) {
			ProjectMapper projectMapper = session
					.getMapper(ProjectMapper.class);
			return projectMapper.getUploadedProjects(studentCode);
		}
	}

}
